package kr.hkit.androidcomplete01.ch06;

import kr.hkit.androidcomplete01.R;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class MultiPage extends Activity {

	View mP1, mP2, mP3;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.ch06_multipage);

		mP1 = findViewById(R.id.page1);
		mP2 = findViewById(R.id.page2);
		mP3 = findViewById(R.id.page3);

		findViewById(R.id.btnpage1).setOnClickListener(mClickListener);
		findViewById(R.id.btnpage2).setOnClickListener(mClickListener);
		findViewById(R.id.btnpage3).setOnClickListener(mClickListener);
	}

	Button.OnClickListener mClickListener = new Button.OnClickListener() {

		@Override
		public void onClick(View v) {
			mP1.setVisibility(View.INVISIBLE);
			mP2.setVisibility(View.INVISIBLE);
			mP3.setVisibility(View.INVISIBLE);

			switch (v.getId()) {
			case R.id.btnpage1:
				mP1.setVisibility(View.VISIBLE);
				break;
			case R.id.btnpage2:
				mP2.setVisibility(View.VISIBLE);
				break;
			case R.id.btnpage3:
				mP3.setVisibility(View.VISIBLE);
				break;
			}
		}

	};

}
